import scala.collection.SortedSet

object SetAndMap {
  def main(args: Array[String]): Unit = {
    //Set基本操作
    var s = Set("aa","bb")
    var t = Set("aa","cc","dd","ee","ff")
//    println(t intersect s)
//    println(t & s)

//    println(t union s)
//    println(t | s)
//    println(t &~ s)
//    println(t diff s)

    //Set append
//    var s1 = Set("aa","bb")
//    s1 += "cc"
//    s1 += "ca"
//    s1 += "cc"  //Set不能有重复值
//    s1 -= "bb"
//    println(s1)
//    var s2 = Set("aa","cc","dd","ee","ff")
//    println(s2 -- s1)
//    println(s2 ++ s1)

    //有序Set
//    var ss = SortedSet("85","25","93","55")
//    println(ss)
//    ss += "33"
//    println(ss)

    //Map基本操作
    var m = Map[String,Int]("a"->1,"b"->2,"c"->3,"d"->4,"e"->5,"f"->6)
    println(m)
    m += ("j"->0)
    m += ("j"->0)
    m += ("j"->11)
    println(m)
    var n = m ++ Map[String,Int]("a"->3,"h"->100)
    println(n)
    n -= ("a","b")
    println(n)

    //对map数据结构进行变换
    val m2 = m.map {
      case(k,v) => (k+"!",v+1)
    }
    println(m2)


  }
}
